<?php
/*
 * @version :  2013-4-22
 * @project :  account-system
 * @Author  :  Allen
 * @e-mail  :  shulei@maszy.cn
 */
  require_once (dirname(__FILE__)."/../config/config.php");
 if(isset($_REQUEST['mac'])){
	 $content = setIPTVPassword($_REQUEST['mac'],$_REQUEST['password']);
	 outPutXml($content);
 }
 

function setIPTVPassword($mac,$password){
	//修改loginlist  字段1 密码
	$sql="select * from zy_equipment  where MacAddress=".$mac;
	$rs = mysql_query($sql);
	$row = mysql_fetch_array($rs);
	
	$sql1="select * from zy_user_service where user_id=".$row['updater']." and equipment_id=".$row['equipment_id'];
	$rs1 = mysql_query($sql1);
	//循环修改,把所有loginlist 里都记录上浏览密码.
	while($row1 = mysql_fetch_array($rs1)){
		$update_sql="UPDATE `zy_login_list` SET `field1` = '$password' WHERE `user_service_id` =".$row1['user_service_id'];
		$rsult = mysql_query($update_sql);
	}
	if($rsult > 0){
		return "success";
	}else{
		return "fail";
	}
	
}

function outPutXml($content) {
	header("Content-type:text/xml");
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
	echo "<netcuberesult>\n";
	echo $content;
	echo "</netcuberesult>";
	die();
}
